{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-10-11T14:48:56.175258Z",
     "start_time": "2025-10-11T14:48:56.160564Z"
    }
   },
   "source": [
    "line = 'nobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false'\n",
    "username, *fields, homedir, sh = line.split(':')\n",
    "print(username)\n",
    "print(fields)\n",
    "print(homedir)\n",
    "print(sh)"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "nobody\n",
      "['*', '-2', '-2', 'Unprivileged User']\n",
      "/var/empty\n",
      "/usr/bin/false\n"
     ]
    }
   ],
   "execution_count": 1
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-10-11T14:54:17.379937Z",
     "start_time": "2025-10-11T14:54:17.362663Z"
    }
   },
   "cell_type": "code",
   "source": [
    "items = [1, 10, 7, 4, 5, 9]\n",
    "first, *rest = items\n",
    "print(first)\n",
    "print(rest)\n",
    "def sum(items):\n",
    "    head, *tail = items\n",
    "    return head + sum(tail) if tail else head\n",
    "print(sum(items))"
   ],
   "id": "33ec0382a0985ab6",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "[10, 7, 4, 5, 9]\n",
      "36\n"
     ]
    }
   ],
   "execution_count": 2
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "fbe7143da364e7e"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
